package com.shenmazong.user.controller;

import com.shenmazong.user.pojo.TbSysUser;
import com.shenmazong.user.pojo.TbUser;
import com.shenmazong.user.service.TbUserService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.IdVo;
import com.shenmazong.vo.LoginUserInfoVo;
import com.shenmazong.vo.PageInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 军哥
 * @version 1.0
 * @description: 健康用户接口
 * @date 2022/4/6 10:20
 */

@RestController
@Slf4j
@CrossOrigin
@RequestMapping(value = "/user")
public class UserController {

    @Autowired
    TbUserService tbUserService;

    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody TbUser user) {
        return tbUserService.add(user);
    }

    @PostMapping(value = "/del")
    public ResultResponse del(@RequestBody IdVo idVo) {
        return tbUserService.del(idVo);
    }

    @PostMapping(value = "/set")
    public ResultResponse set(@RequestBody TbUser user) {
        return tbUserService.set(user);
    }

    @PostMapping(value = "/getUserById")
    public ResultResponse getUserById(@RequestBody IdVo idVo) {
        return tbUserService.getUserById(idVo);
    }

    @PostMapping(value = "/getSysUserByPage")
    public ResultResponse getUserByPage(@RequestBody PageInfoVo pageInfoVo) {
        return tbUserService.getUserByPage(pageInfoVo);
    }

    @PostMapping(value = "/loginByUserName")
    public ResultResponse loginByUserName(@RequestBody LoginUserInfoVo loginUserInfoVo) {
        return tbUserService.loginByUserName(loginUserInfoVo);
    }
}
